<script language="javascript" type="text/javascript">
function Preview(){
  with(document.form1){
    action = OpenReport("rpt.php?__par=<?php getlink('./transaksi/trsimulasikredit.report.php') ?>") ; 
    
  }
}
function InitValue(){
    with(document.form1){
      cCabang.value = "<?= aCfg('msKodeCabang') ?>" ;
      cKode.value = "" ;
      cNama.value = "" ;
      cAlamat.value = "" ;
      cCabangKredit.value = "<?= aCfg('msKodeCabang') ?>" ;
      cGolonganKredit.value = "" ;
      cUrutKredit.value = "" ;
      cFrekuensiKredit.value = "" ;
      cCabangTabungan.value = "<?= aCfg('msKodeCabang') ?>" ;
      cGolonganTabungan.value = "" ;
      cUrutTabungan.value = "" ;
      cFrekuensiTabungan.value = "" ;
      cNoPengajuan.value = "" ;
      nPlafondPengajuan.value = "" ;
      cNoSPK.value = "" ;
      cSifatKredit.value = "" ;
      cKeteranganSifatKredit.value = "" ;
      cJenisPenggunaan.value = "" ;
      cKeteranganJenisPenggunaan.value = "" ;
      cGolonganDebitur.value = "" ;
      cKeteranganGolonganDebitur.value = "" ;
      cSektorEkonomi.value = "" ;
      cKeteranganSektorEkonomi.value = "" ;
      cWilayah.value = "" ;
      cKeteranganWilayah.value = "" ;
      cAO.value = "" ;
      cKeteranganAO.value = "" ;
      cGolonganPenjamin.value = "" ;
      cKeteranganGolonganPenjamin.value = "" ;
      cBagianYangDijamin.value = "" ;
      cCabangTabungan.value = "" ;
      cGolonganTabungan.value = "" ;
      cUrutTabungan.value = "" ;
      cFrekuensiTabungan.value = "" ;
      cNamaTabungan.value = "" ;
      cAlamatTabungan.value = "" ;
      nPlafond.value = "0" ;
      nSukuBunga.value = "0" ;
      nLama.value = "0" ;
      nMusiman.value = "1" ;
      nGracePeriod.value = "1" ;
      nGracePeriodPokokAwal.value = "0" ;
      nGracePeriodBungaAwal.value = "0" ;
      nAdministrasi.value = "0" ;
      nNotaris.value = "0" ;
      cKodeNotaris.disabled = 1 ;
      cKodeNotaris.value = "" ;
      cNamaNotaris.value = "" ;
      chckNotaris.checked = 0 ;
      nMaterai.value = "0" ;
      nAsuransi.value = "0" ;
      cKodeAsuransi.disabled = 1 ;
      cKodeAsuransi.value = "" ;
      cNamaAsuransi.value = "" ;
      chckAsuransi.checked = 0 ;
      nProvisi.value = "0" ;
      nTotalRealisasi.value = "0" ; 
      nPersAdministrasi.value = "0.00" ;
      nPersProvisi.value = "0.00" ;
      cCaraPerhitungan.value = "";
      cInstansi.value = "" ;
      cKeteranganInstansi.value = "";
      cCassie.value = "" ;
      cKeteranganCassie.value = "" ;
      cKolektor.value = "";
      cKeteranganKolektor.value = "" ;
      for(n=1; n<=5; n++){
        s = "cBank" + n + ".value = " + "' ' " + ";" + "cNBG" + n + ".value = " + "' ' " + ";" + "nNominal" + n + ".value = " + "' ' " + ";" + "nBunga" + n + ".value = " + "' ' " + ";" + "nNilaiTunai" + n + ".value = " + "' ' " ;
        eval(s);
      }
      nTotNominal.value = "" ;
      nTotBunga.value = "" ;
      nTotNilaiTunai.value = "" ;
    }
  }
/**************************************************************************************************************************************************************************************************/
  function cGolonganKredit_onButtonClick(field){
    var cSQL = "select Kode,Keterangan from golongankredit order by Kode";
    Browse(cSQL,field.name);
  }
  
  function cGolonganKredit_onBlur(field){
    with(document.form1){      
      ajax('','SeekGolonganKredit()',GetFormContent()) ;      
    }
  }
/**************************************************************************************************************************************************************************************************/
  function nLama_onBlur(field){
    ajax('','SeekProvisiAdministrasi()',GetFormContent()) ;
  }
  
  function ValidSaving(){
    ajax('','ValidSaving()',GetFormContent(document.form1)) ;
  }
  
/**************************************************************************************************************************************************************************************************/
  function SumJumlah(){
    with(document.form1){
      nTotalRealisasi.value = String2Number(nPlafond.value) - String2Number(nAdministrasi.value) - String2Number(nNotaris.value) -
                              String2Number(nMaterai.value) - String2Number(nProvisi.value) - String2Number(nAsuransi.value) - String2Number(nBiayaTaksasi.value) ;
      nPlafond.value = Number2String(nPlafond.value,0) ;
      nSukuBunga.value = Number2String(nSukuBunga.value,3) ;
      nAdministrasi.value = Number2String(nAdministrasi.value,0) ;
      nNotaris.value = Number2String(nNotaris.value,0) ;
      nMaterai.value = Number2String(nMaterai.value,0) ;
      nProvisi.value = Number2String(nProvisi.value,0) ;
      nAsuransi.value = Number2String(nAsuransi.value,0) ;
      nTotalRealisasi.value = Number2String(nTotalRealisasi.value,0) ;
      nBiayaTaksasi.value = Number2String(nBiayaTaksasi.value,0) ;
    }
  }

/**************************************************************************************************************************************************************************************************/
function OpenField(va,vb,vc){
  va.disabled = 1 ;
  va.readOnly = 1 ;

  if(vb.checked == 1){
    va.disabled = 0 ;
    va.readOnly = 0 ;            
  }else{
    va.value = "" ;
    if(va.name == 'cKodeNotaris'){
      document.form1.cNamaNotaris.value = "";
    }else{
      document.form1.cNamaAsuransi.value = "" ;
    }   
  }      
}

/**************************************************************************************************************************************************************************************************/
function PickKeterangan(field,table){ 
  var cSQL = "Select n.Kode,n.Keterangan,n.RekeningTabungan from " + table + " n left join tabungan t on t.rekening = n.rekeningtabungan";  
  Browse(cSQL,field.name);
}
</script>